using System;
using RpgXna.Model.Menu;
using RpgXna.Model.XnaClassesWrappers;

namespace RpgXna.Model.Interfaces.Inventory.NavigationBehaviors
{
    class InventoryShowHideBehavior : KeysInputBehavior
    {
        private readonly Action _action;

        public InventoryShowHideBehavior(Func<bool> predicate, Action action)
        {
            _action = action;
            Predicate = predicate;
        }

        public void Execute(IKeyboardStateWrapper kbs)
        {
            CurKbs = kbs;
            if (KeyPressed(InputBindings.Bindings.Inventory))
            {
                if (_action != null)
                {
                    _action();
                }
            }
            Prevkbs = kbs;
        }
    }
}